package com.itcast.zhbj.util;

import android.content.Context;
import android.content.SharedPreferences;

public class SharedPreferencesUtil {
	private static SharedPreferences sharedPreferences;
	//存储
	public static void saveString(Context context,String key,String value){
		if(sharedPreferences == null){
			sharedPreferences = context.getSharedPreferences("config", Context.MODE_PRIVATE);
		}
		sharedPreferences.edit().putString(key, value).commit();
	}
	//读取
	public static String getString(Context context,String key,String defValue){
		if(sharedPreferences == null){
			sharedPreferences = context.getSharedPreferences("config", Context.MODE_PRIVATE);
		}
		return sharedPreferences.getString(key, defValue);
	}
}
